package com.chuangke.monitor.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.chuangke.common.http.HttpResult;
import com.chuangke.monitor.service.ServerMonitorServer;

/**
 * 服务器监控
 */
@RestController
@RequestMapping("/monitor")
public class ServerMonitorController {

    @Autowired
    private ServerMonitorServer serverMonitorServer;

    @PreAuthorize("hasAuthority('login:action')")
    @GetMapping(value = "/server")
    public HttpResult getInfo() {
        return HttpResult.ok(serverMonitorServer.getServerInfo());
    }
}
